package com.lwgk.mvp.model;

import android.content.Context;
import android.support.v4.view.ViewPager;

import com.lwgk.adapter.BannerPagerAdapter;
import com.lwgk.constant.ConstantUtils;
import com.lwgk.mvp.presenter.SplashSmoothPlatePresentImpl;
import com.lwgk.mvp.presenter.SplashSmoothPlateView;
import com.lwgk.utils.SaveDataUtils;
import com.lwgk.widget.SmoothPlateBanner;

import java.util.List;

/**
 * created by 赵航
 * 联系微信 微信号：zhao--hang--
 * on 2019/7/12
 * --------------------------------------------------------------------------
 * 描述：
 * 注意事项：
 */
public class SplashSmoothPlatePresent implements SplashSmoothPlatePresentImpl {
    private SplashSmoothPlateView mView;

    public SplashSmoothPlatePresent(SplashSmoothPlateView splashSmoothPlateActivity) {
        this.mView = splashSmoothPlateActivity;
    }

    @Override
    public void sevesMoothPlate() {
        //如果保存失败就再保存一次
        boolean putData = SaveDataUtils.putData(ConstantUtils.SMOOTHPLATE, true);
        if (!putData){
            SaveDataUtils.putData(ConstantUtils.SMOOTHPLATE, true);
        }
    }

    @Override
    public void dealMoothhPlateData(SmoothPlateBanner smoothPlateBanner, ViewPager viewPager, List<Integer> list, Context context) {
        smoothPlateBanner.getTotal(list.size());
        viewPager.setAdapter(new BannerPagerAdapter(list,context));
    }
}
